
function deleteTutorial(tutorialId) {
    if (confirm("确定要删除此教程?")) {
        $.ajax({
            url: "/Origami/deleteTutorial",
            data: {tutorialId: tutorialId},
            type: "post",
            dataType: "json",
            async: false,
            complete: function (data) {
                if (data.responseText == 'success') {
                    $("#" + tutorialId + "_all").hide();
                } else {
                    alert("删除失败")
                }
            }
        })
    }

}


var page = 2;
$('#loading-more').click(function () {
    var btn = $(this)
    btn.button('loading')
    $.ajax({
        url: "/Origami/showMoreMyTutorials",
        type: "post",
        data: {page: page},
        dataType: "json",
        async: false,
        success: function (data) {
            if(data.status == "ok"){
                $("#loading-more").before(data.jsonString);
            }
            if(data.requires_pagination == false || data.status == "empty"){
                btn.hide();
            }else{
                btn.button('reset')
            }
            page++;
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest);
            alert(textStatus);
            alert(errorThrown);
        }
    })
});
